<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Click'N'Gage - Registration</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" href="css/style.css" type="text/css" />
    </h:head>
    <h:body>
        <div id="container">
            <div id="wrapper">
                <div id="top">
                    <ui:include src="WEB-INF/includes/login.xhtml"/>
                </div>

                <ui:include src="WEB-INF/includes/navigation.xhtml"/>

                <div id="header">
                    <ui:include src="WEB-INF/includes/header.xhtml"/>
                </div>
                <div id="content">
                    <h1>Registration Form</h1>
                    <h:form>
                        <h:panelGrid columns="2">
                            <label>Title:</label>
                            <h:selectOneMenu value="#{accountManagedBean.title}">
                                <f:selectItem itemLabel="Mr." itemValue="Mr." />
                                <f:selectItem itemLabel="Mrs." itemValue="Mrs." />
                                <f:selectItem itemLabel="Dr." itemValue="Dr." />
                            </h:selectOneMenu>

                            <label>First Name:</label>
                            <h:inputText value="#{accountManagedBean.firstName}"/>

                            <label>Last Name:</label>
                            <h:inputText value="#{accountManagedBean.lastName}"/>

                            <label>Department:</label>
                            <h:selectOneMenu value="#{accountManagedBean.departmentID}">
                                <f:selectItems value="#{accountManagedBean.departments}"
                                               var="department"
                                               itemLabel="#{department.name}"
                                               itemValue="#{department.id}"/>
                            </h:selectOneMenu>

                            <label>Username:</label>
                            <h:inputText value="#{accountManagedBean.username}"/>

                            <label>Password:</label>
                            <h:inputSecret value="#{accountManagedBean.password}"/>

                            <label>Access Code:</label>
                            <h:inputText value="#{accountManagedBean.accessCode}"/>
                        </h:panelGrid>
                        <h:commandButton value="Register" action="#{accountManagedBean.registerActionHandler}" />

                        <br /><br/>
                        <h:messages styleClass="error" />
                        <h:outputText value="#{accountManagedBean.errorMessage}" styleClass="error" rendered="#{accountManagedBean.errorMessage != null}"/>
                    </h:form>
                </div>
                <div id="sidebar">
                    <h2>Quick Links</h2>
                    <ui:include src="WEB-INF/includes/quicklinks.xhtml"/>
                    <h2>Downloads</h2>
                    <ui:include src="WEB-INF/includes/download.xhtml"/>
                    <h2>Advertisments</h2>
                    <ui:include src="WEB-INF/includes/adsense.xhtml"/>
                </div>
                <div id="footer">
                    <ui:include src="WEB-INF/includes/footer.xhtml"/>
                </div>
            </div>
        </div>
    </h:body>
</html>